<template>
    <div class=''>
        <img :src="codeUrl" @click="getCode" class="login-code-img"/>
    </div>
</template>

<script>
    import { getCodeImg } from "@/api/login";
    export default {
        name: "login",
        data() {
            return {
                codeUrl: "",
            }
        },
        created() {
            this.getCode();
        },
        methods: {
            getCode() {
                getCodeImg().then(res => {
                    this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
                    if (this.captchaOnOff) {
                        this.codeUrl = "data:image/gif;base64," + res.img;
                    }
                });
            },
        },
    }
</script>

<style scoped lang='scss'>

</style>
